<template>
	<el-drawer title="值班详情" v-model="visible" :size="600" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-form-item label="值班标题">{{ form.title }}
					</el-form-item>
					<el-form-item label="值班类型">{{ form.sortName }}
					</el-form-item>
					<el-form-item label="开始时间">{{ form.beginTime }}
					</el-form-item>
					<el-form-item label="结束时间">{{ form.endTime }}
					</el-form-item>
					<el-form-item label="值班人">{{ form.dutyUserName }}
					</el-form-item>
					<el-form-item label="联系电话">{{ form.tel }}
					</el-form-item>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>
<script>

export default {
	emits: ['success', 'closed'],
	components: {},
	data() {
		return {
			visible: false,
			isSaveing: false,
			//所需数据选项
			form: {
				title:'',
				sortName:'',
				beginTime: '',
				endTime: '',
				tel: '',
				dutyUserName: '',
			}
		}
	},
	mounted() {
	},
	methods: {
		open() {
			this.visible = true;
			return this
		},
		setData(data) {
			this.form.title = data.title
			this.form.sortName = data.sortName
			this.form.beginTime = data.beginTime
			this.form.endTime = data.endTime
			this.form.tel = data.tel
			this.form.dutyUserName = data.dutyUserName
		},
		async getDutyRecordById(data) {
			var res = await this.$API.office.duty.getDutyRecordById.get({recordId: data.recordId});
			if (res.code == 200) {
				this.form = res.data;
			}else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
	}
}
</script>

<style>
.customWidth {
	width: 60%;
}
</style>
